package cn.tedu.hospitalqd.controller;


import cn.tedu.hospitalqd.pojo.dto.InhospitalAddNewDTO;
import cn.tedu.hospitalqd.service.InhospitalService;
import cn.tedu.hospitalqd.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Slf4j
@RestController
@RequestMapping("/inhospitals")
@Api(tags = "05. 住院管理模块")
@Validated
public class InhospitalController {

    @Autowired
    private InhospitalService inhospitalService;

    // http://localhost:10086/inhospitals/add-new?name=TestName001&description=TestDescription001&sort=199
    @PostMapping("/add-new")
    @ApiOperation("添加患者")
    @ApiOperationSupport(order = 100)
    public JsonResult addNew(@Valid InhospitalAddNewDTO inhospitalAddNewDTO) {
        log.debug("开始处理【添加患者】的请求，参数：{}", inhospitalAddNewDTO);
        inhospitalService.addNew(inhospitalAddNewDTO);
        return JsonResult.ok();
    }



}
